// Author: Bjorn Schobben


#ifndef MINIMAP_H
#define MINIMAP_H

#include "Pixel.h"
#include "Poly.h"
#include "World.h"
#include "Vector.h"
#include "Camera.h"


class Minimap
{
public:
	Minimap(const World& world, int renderWidth, int renderHeight, const Camera& camera, const Pixel& mapColor, const Pixel& wallColor, const Pixel& eyeColor);
	Minimap(const Minimap& rhs);
	~Minimap();

	const Pixel& GetPixel(unsigned int x, unsigned int y) const;
	const Poly& GetViewPoly() const;
	unsigned int GetHeight() const;
	unsigned int GetWidth() const;

protected:

private:
	void SetPixel(unsigned int x, unsigned int y, const Pixel& pixel);

	void SetEye(const Vector& eyepoint);
	void SetEyePixels(const Pixel& eyeColor);
	void SetFieldOfView(const Vector& direction, const Vector& plane);
	void SetMapPixels(const World& world, const Pixel& mapColor, const Pixel& wallColor);
	void SetMapRange(const Vector& eyepoint, const World& world);
	void Allocate();

	Pixel* map;
	int width, height, borderlessWidth, borderlessHeight;
	Poly fov;
	Vector eye;
	Scalar leftEdge;
	Scalar rightEdge;
	Scalar topEdge;
	Scalar bottomEdge;

	static const unsigned int WORLDSHOWSIZE = 3;
	static const unsigned int BORDERWIDTH = 2, BORDERHEIGHT = 2;

};

#endif //MINIMAP_H